From 8215fded94e8b69bb4f96be647ec148aa201cdd6 Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Mon, 24 Jun 2019 06:12:31 +0200 Subject: [PATCH] phase2: add ability to clone feeds via SSH Signed-off-by: Jo-Philipp Wich --- phase2/config.ini.example | 1 + phase2/master.cfg | 27 +++++++++++++++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/phase2/config.ini.example b/phase2/config.ini.example index 2b250a3..2df80f8 100644 --- a/phase2/config.ini.example +++ b/phase2/config.ini.example @@ -5,6 +5,7 @@ buildbot_url = http://phase2.builds.lede-project.org/ homedir = ../phase1 port = 9990 persistent = false +git_ssh = true [status] bind = tcp:8011:interface=127.0.0.1 diff --git a/phase2/master.cfg b/phase2/master.cfg index 5a3f005..3e9d1c7 100644 --- a/phase2/master.cfg +++ b/phase2/master.cfg @@ -31,6 +31,7 @@ slave_port = 9990 persistent = False other_builds = 0 tree_expire = 0 +git_ssh = False if ini.has_option("general", "port"): slave_port = ini.getint("general", "port") @@ -44,6 +45,9 @@ if ini.has_option("general", "other_builds"): if ini.has_option("general", "expire"): tree_expire = ini.getint("general", "expire") +if ini.has_option("general", "git_ssh"): + git_ssh = ini.getboolean("general", "git_ssh") + c['slaves'] = [] max_builds = dict() @@ -340,13 +344,36 @@ for arch in arches: command = ["./ccache.sh"], haltOnFailure = True)) + if git_ssh: + factory.addStep(FileDownload( + name = "dlgitclonekey", + mastersrc = home_dir+"/git-clone.key", + slavedest = "../git-clone.key", + mode = 0600)) + + factory.addStep(ShellCommand( + name = "patchfeedsconf", + description = "Patching feeds.conf", + workdir = "build/sdk", + command = "sed -e 's#https://#ssh://git@#g' feeds.conf.default > feeds.conf", + haltOnFailure = True)) + factory.addStep(ShellCommand( name = "updatefeeds", description = "Updating feeds", workdir = "build/sdk", command = ["./scripts/feeds", "update", "-f"], + env = {'GIT_SSH_COMMAND': WithProperties("ssh -o IdentitiesOnly=yes -o IdentityFile=%(cwd)s/git-clone.key -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no", cwd=GetCwd)} if git_ssh else {}, haltOnFailure = True)) + if git_ssh: + factory.addStep(ShellCommand( + name = "rmfeedsconf", + description = "Removing feeds.conf", + workdir = "build/sdk", + command=["rm", "feeds.conf"], + haltOnFailure = True)) + factory.addStep(ShellCommand( name = "installfeeds", description = "Installing feeds", -- 2.30.2